package com.lyz.dataStructure.algorithm.beike2020;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:32
 * @Description:
 **/

    import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/8/10 20:32
 *@Description:
 **/
public class Main4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N= sc.nextInt();
        int[] arr = new int[N];
        for(int i =0;i<arr.length;i++){
            arr[i] = sc.nextInt();
        }
        System.out.println(0);
    }
    public static  int shu(int[] arr){
        if(arr.length<2||arr==null){
            return 0;
        }
        int count = 0;
        int p =0,q =arr.length-1;
        while (arr[++p]>arr[p-1]&&p<arr.length);
        while (arr[--q]>arr[q+1]&&q>0);
        if(p<q){
            count += arr[p-1] -arr[p]+arr[q+1] -arr[q]+2;
            arr[p] = arr[p-1]+1;
            arr[q] = arr[q+1]+1;
        }
        if(p<q){
            int temp = arr[p];
            arr[p] = Math.max(arr[p-1],arr[q+1]+1);
            count+= arr[p]-temp;
        }
       return count;
    }
}
